package cn.edu.scau.cmi.mazhuanglong.esercise7;

interface CompurerAverage{
	public double average(double a,double b);
}

class A implements CompurerAverage{
	public double average(double a, double b) {
		double aver=0;
		aver=(a+b)/2;
		return aver;
	}
}

class B implements CompurerAverage{
	public double average(double a,double b) {
		double aver=0;
		aver=Math.sqrt(a*b);
		return aver;
	}
}

public class Example7_3 {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		CompurerAverage computer;
		double a=10,b=90;
		computer=new A();
		double result=computer.average(a, b);
		System.out.println(result);
		
		computer=new B();
		result=computer.average(a, b);
		System.out.println(result);
	}

}
